
Security News
Open Source Maintainers Feeling the Weight of the EU’s Cyber Resilience Act
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
available-typed-arrays
Advanced tools
Returns an array of Typed Array names that are available in the current environment
The available-typed-arrays npm package provides a simple way to list all available typed array constructors in the current environment. This can be particularly useful for applications that need to work with binary data in a way that is compatible across different platforms and JavaScript environments. It helps in identifying which typed arrays are supported, allowing developers to write more adaptable and robust code.
Listing available typed arrays
This feature allows you to retrieve an array of strings representing the names of all available typed array constructors. The code sample demonstrates how to use the package to get the list of available typed arrays and then log them to the console.
const availableTypedArrays = require('available-typed-arrays');
const typedArrays = availableTypedArrays();
console.log(typedArrays);
The 'typedarray' package provides a polyfill for TypedArray functionality for older browsers that do not support the latest JavaScript standards. While 'available-typed-arrays' helps in identifying available typed arrays in the environment, 'typedarray' aims to fill the gap by providing the functionality itself when it's not natively available. This makes 'typedarray' more focused on compatibility and polyfilling, whereas 'available-typed-arrays' is more about detection and adaptability.
The 'buffer' package is a node.js library for binary data manipulation. It provides a way to work with binary data through a Buffer class, which is similar to the typed arrays in JavaScript. While 'buffer' is more about providing a comprehensive set of tools for binary data manipulation, 'available-typed-arrays' focuses on identifying which typed array constructors are available in the current environment. 'buffer' can be seen as complementary to 'available-typed-arrays' for applications that need both data manipulation and environment adaptability.
Returns an array of Typed Array names that are available in the current environment.
var availableTypedArrays = require('available-typed-arrays');
var assert = require('assert');
assert.deepStrictEqual(
availableTypedArrays().sort(),
[
'Int8Array',
'Uint8Array',
'Uint8ClampedArray',
'Int16Array',
'Uint16Array',
'Int32Array',
'Uint32Array',
'Float32Array',
'Float64Array',
'BigInt64Array',
'BigUint64Array'
].sort()
);
Simply clone the repo, npm install
, and run npm test
FAQs
Returns an array of Typed Array names that are available in the current environment
The npm package available-typed-arrays receives a total of 41,734,163 weekly downloads. As such, available-typed-arrays popularity was classified as popular.
We found that available-typed-arrays demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.